package cn.com.haopy.dataes.db.datasource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author keel
 */
public class DynamicDataSource extends AbstractRoutingDataSource {
    private final Log logger = LogFactory.getLog(DataSourceContextHolder.class);

    @Override
    protected Object determineCurrentLookupKey() {
        String datasource = DataSourceContextHolder.getDbType();

        logger.debug("current used datasource is " + datasource);

        return datasource;
    }
}
